package com.nbsaas.boot.data.rest.convert;

import com.nbsaas.boot.data.data.entity.QueryCatalog;
import com.nbsaas.boot.data.api.domain.request.QueryCatalogRequest;

import org.springframework.beans.BeanUtils;
import com.nbsaas.boot.rest.api.Converter;
import com.nbsaas.boot.utils.BeanDataUtils;
            import com.nbsaas.boot.data.data.entity.QueryCatalog;

/**
* 请求对象转换成实体对象
*/

public class QueryCatalogEntityConvert  implements Converter<QueryCatalog, QueryCatalogRequest> {

    @Override
    public QueryCatalog convert(QueryCatalogRequest source) {
        QueryCatalog result = new QueryCatalog();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getParent()!=null){
                    QueryCatalog parent =new QueryCatalog();
                    parent.setId(source.getParent());
                    result.setParent(parent);
                    }
        return result;
    }
}

